{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 前言\n",
    "\n",
    "数据的切片，说着挺玄乎，但是也是生动，就像面包切片，你把数据比作一块面包，让我们来一起切片试试。\n",
    "\n",
    "# 方法\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "+ `loc`：通过索引名称来进行切片"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "      Unnamed: 0    ts_code  symbol  name area industry  list_date\n",
      "0              0  000001.SZ  000001  平安银行   深圳       银行   19910403\n",
      "1              1  000002.SZ  000002   万科A   深圳     全国地产   19910129\n",
      "2              2  000004.SZ  000004  国农科技   深圳     生物制药   19910114\n",
      "3              3  000005.SZ  000005  世纪星源   深圳     环境保护   19901210\n",
      "4              4  000006.SZ  000006  深振业A   深圳     区域地产   19920427\n",
      "...          ...        ...     ...   ...  ...      ...        ...\n",
      "3719        3719  688366.SH  688366  昊海生科   上海     生物制药   20191030\n",
      "3720        3720  688368.SH  688368  晶丰明源   上海      半导体   20191014\n",
      "3721        3721  688369.SH  688369  致远互联   北京     软件服务   20191031\n",
      "3722        3722  688388.SH  688388  嘉元科技   广东      元器件   20190722\n",
      "3723        3723  688389.SH  688389  普门科技   深圳     医疗保健   20191105\n",
      "\n",
      "[3724 rows x 7 columns]\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd \n",
    "df = pd.read_csv('stock_basic.csv',dtype = {'symbol' : str})\n",
    "\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "+ `iloc`：通过索引值来进行切片"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "+ `ix`：通过索引名称 或者 索引值来进行切片"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "+ `loc` + `iloc`：搭配使用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
